package bma.common.langutil.jmshell.cmdopt;

import java.util.Locale;

/**
 * An option that expects an integer value
 */
public class IntegerOption extends Option<Integer> {

	public IntegerOption(char shortForm, String longForm, String tips) {
		super(Integer.class, shortForm, longForm, true, tips);
	}

	public IntegerOption(String shortForm, String longForm, String tips) {
		super(Integer.class, shortForm, longForm, true, tips);
	}

	@Override
	protected Integer parseValue(String arg, Locale locale)
			throws IllegalOptionValueException {
		try {
			return new Integer(arg);
		} catch (NumberFormatException e) {
			throw new IllegalOptionValueException(this, arg);
		}
	}
}